#include <linux/fs.h>
#include <linux/slab.h>
#include "ntfs_kernel.h"

static struct inode *ntfs_alloc_inode(struct super_block *sb) {
    struct ntfs_inode_info *ni;
    
    ni = kmem_cache_alloc(ntfs_inode_cachep, GFP_NOFS);
    if (!ni)
        return NULL;
    
    memset(ni, 0, sizeof(*ni));
    return &ni->vfs_inode;
}

static void ntfs_destroy_inode(struct inode *inode) {
    struct ntfs_inode_info *ni = NTFS_I(inode);
    kmem_cache_free(ntfs_inode_cachep, ni);
}

static const struct address_space_operations ntfs_aops = {
    .readpage    = ntfs_readpage,
    .writepage   = ntfs_writepage,
};

static const struct inode_operations ntfs_file_inode_ops = {
    .getattr    = ntfs_getattr,
    .setattr    = ntfs_setattr,
};

static const struct file_operations ntfs_file_operations = {
    .llseek     = generic_file_llseek,
    .read_iter  = generic_file_read_iter,
    .write_iter = generic_file_write_iter,
    .mmap       = generic_file_mmap,
};
